<extend name="Adminuser/index" />

<block name="main">
	<div class="panel-heading">{$title}</div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-7" style="margin-left:185px;">
					<p>
						给 <b>{$users.username}</b> 分配权限
					</p>			
					<form action="{:U('Admin/Adminuser/saverole')}" method='post'>
					<p style="width:600px" id="p">
						<volist name="list" id="vo">
							<input type="checkbox" name="role[]" class="check" value="{$vo.id}" <if condition="in_array($vo['id'],$role) eq true">checked</if>>{$vo.name}
							&nbsp;
							&nbsp;
							&nbsp;
						</volist>
					</p>
					<div style="margin-top:10px;">
						<input type="hidden" name="uid" value="{$users.id}">
						<input type="submit" value="保存" class="btn btn-info">
						<input type="button" value="全选" id="btn1" class="btn btn-primary">
						<input type="button" value="清空" id="btn2" class="btn btn-success">
						<input type="button" value="反选" id="btn3" class="btn btn-danger">
						<input type="reset" value="重置" class="btn btn-warning">
					</form>
					</div>
				</div>
			</div>
		</div>
	</div>	
<script>
	$(function(){
		$('#btn1').click(function(){
 			$(".check").each(function(){
  				$(this).prop("checked",true);
  			});
 		});
 		$('#btn2').click(function(){
 			$(".check").each(function(){
  				$(this).prop("checked",false);
  			});
 		});
 		$("#btn3").click(function(){ 
            $(".check").each(function(){  
                $(this).prop("checked", !$(this).prop("checked"));  
            });  
        });    
	});
</script>		
</block>